Add auto model policy support#356
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 39119849-5c11-476e-941b-4c3574c369cf
There was a problem hiding this comment.
Pull request overview
Adds support for “Auto” model GA by switching client logic to rely on the stable Auto model ID (auto) and by wiring a new policy-driven refresh path so the model inventory updates when the Auto model is enabled/disabled by org policy.
Changes:
- Update Auto-model detection to use the stable model ID (
id == "auto") instead of the display name. - Introduce
autoModel.enabledpolicy plumbing (policy params → feature flag → event) and refresh model inventory on policy changes. - Improve model selection fallback behavior and add/expand tests covering Auto model policy behavior and event publishing.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/utils/ModelUtils.java | Switch Auto model detection to stable ID-based logic. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services/ModelService.java | Refresh models on Auto-model policy event; adjust default/fallback handling and selection persistence. |
| com.microsoft.copilot.eclipse.ui.test/src/com/microsoft/copilot/eclipse/ui/utils/ModelUtilsTests.java | Update/add tests to validate Auto handling is ID-based (not display-name based). |
| com.microsoft.copilot.eclipse.ui.test/src/com/microsoft/copilot/eclipse/ui/chat/services/ModelServiceTests.java | Add UI-level tests for policy-driven model inventory refresh and deterministic fallback selection. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/policy/DidChangePolicyParams.java | Add autoModel.enabled policy field + equality/hash/toString updates. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/CopilotLanguageClient.java | Publish Auto model policy change event when the policy value changes. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/FeatureFlags.java | Add autoModelPolicyEnabled feature flag storage. |
| com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/events/CopilotEventConstants.java | Add new event topic constant for Auto model policy changes. |
| com.microsoft.copilot.eclipse.core.test/src/com/microsoft/copilot/eclipse/core/lsp/CopilotLanguageClientTests.java | Add test to ensure Auto-model policy event is published only on value changes. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 39119849-5c11-476e-941b-4c3574c369cf
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 39119849-5c11-476e-941b-4c3574c369cf
| if (currentActive == null || !isCurrentModelAvailable) { | ||
| // Try to restore user's preferred model if it's available in current mode | ||
| String restoredModelId = restoreActiveModel(); | ||
| if (restoredModelId != null && modelsForCurrentMode.containsKey(restoredModelId)) { | ||
| ensureRealm(() -> activeModelObservable.setValue(modelsForCurrentMode.get(restoredModelId))); | ||
| String restoredModelKey = restoreActiveModel(); | ||
| if (restoredModelKey != null && modelsForCurrentMode.containsKey(restoredModelKey)) { |
There was a problem hiding this comment.
From my understanding, the fallback model persistence is skipped by design, right?
As the persisted Auto preference is only checked when the current model is unavailable, after Auto is disabled, the temporary fallback is selected; when Auto is re-enabled, that fallback is still available, so this block is skipped and Auto is never restored.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9c1d41fc-996c-4e22-aa02-8ba170779b75
fix #305